package org.asiainfo.common.tenant.handle;

import cn.hutool.core.util.ObjectUtil;
import com.mybatisflex.core.tenant.TenantFactory;
import org.asiainfo.common.tenant.utils.TenantHelper;

/**
 * 租户工厂实现类
 *
 * @author dotor-ww
 */
public class MyTenantFactory implements TenantFactory {

    /**
     * 获取租户ID
     *
     * @return 租户组
     */
    @Override
    public Object[] getTenantIds() {
        Long tenantId = TenantHelper.getTenantId();
        if (ObjectUtil.isNull(tenantId)) {
            return null;
        }
        return new Object[]{tenantId};
    }
}

